<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        html,
        body,
        #app {
            height: 100%;
        }

        .bgc {
            background-color: black;
        }
    </style>
</head>

<body>
    <div id="app" :class="{bgc:isFlag}">
        <h1>{{msg}}</h1>
        <hr>
        <button @click="changeHandle">点击开关灯</button>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        let vm = new Vue({
            el: '#app',
            data: {
                msg: "Hello Vue",
                isFlag: false
            },
            methods: {
                changeHandle() {
                    this.isFlag = !this.isFlag
                }
            }
        });
    </script>
</body>

</html>